﻿//////////////////////////////////////////////////////////////////////////
// FileName:BusApply.cs
// CreateBy:DragonXiong
// CreateDate:2010-5-22
// Description:
//		BusApply class
//
// Modify Log:
//
// Copyright:
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Auto.Components;

namespace Auto.Data.BusMan.Model
{
    [Serializable]
    public class BusApply
    {
        #region --Field--
        ///<summary>
        ///Data Table Bus_BusApply
        ///</summary>
        public const string TABLENAME_Bus_BusApply = "Bus_BusApply";
        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_RecID = "RecID";
        /// <sumary> 
        /// (DocID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DocID = "DocID";
        /// <sumary> 
        /// (BusID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_BusID = "BusID";
        /// <sumary> 
        /// (Applyer Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_Applyer = "Applyer";
        /// <sumary> 
        /// (ApplyDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_ApplyDate = "ApplyDate";
        /// <sumary> 
        /// (DriveTo Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DriveTo = "DriveTo";

        /// <sumary> 
        /// (DriveTo Type:NVarChar Len:200) 
        /// </sumary> 
        public const string FIELD_DriveToDesc = "DriveToDesc";

        /// <sumary> 
        /// (DriveTo Type:NVarChar Len:200) 
        /// </sumary> 
        public const string FIELD_DriveToOther = "DriveToOther";

        /// <sumary> 
        /// (WorkTaskID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_WorkTaskID = "WorkTaskID";
        /// <sumary> 
        /// (WorkTaskDesc Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_WorkTaskDesc = "WorkTaskDesc";

        /// <sumary> 
        /// (WorkTaskDesc Type:NVarChar Len:200) 
        /// </sumary> 
        public const string FIELD_WorkTaskOther = "WorkTaskOther";

        /// <sumary> 
        /// (PlanToTime Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_PlanToTime = "PlanToTime";
        /// <sumary> 
        /// (PlanBackTime Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_PlanBackTime = "PlanBackTime";
        /// <sumary> 
        /// (ApprovedBy Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_ApprovedBy = "ApprovedBy";
        /// <sumary> 
        /// (ApprovedNote Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_ApprovedNote = "ApprovedNote";
        /// <sumary> 
        /// (RecDivID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_RecDivID = "RecDivID";
        /// <sumary> 
        /// (RecAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_RecAcct = "RecAcct";
        /// <sumary> 
        /// (RecDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_RecDate = "RecDate";
        /// <sumary> 
        /// (CFM Type:Bit Len:0) 
        /// </sumary> 
        public const string FIELD_CFM = "CFM";
        /// <sumary> 
        /// (CFMAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_CFMAcct = "CFMAcct";
        /// <sumary> 
        /// (CFMDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_CFMDate = "CFMDate";
        /// <sumary> 
        /// (Void Type:Bit Len:0) 
        /// </sumary> 
        public const string FIELD_Void = "Void";
        /// <sumary> 
        /// (VoidAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_VoidAcct = "VoidAcct";
        /// <sumary> 
        /// (VoidDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_VoidDate = "VoidDate";
        /// <sumary> 
        /// (UserAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_UserAcct = "UserAcct";
        /// <sumary> 
        /// (LastUpdateDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_LastUpdateDate = "LastUpdateDate";
        #endregion --Field--

        #region --Property--
        private int _recid;
        private string _docid;
        private string _busid;
        private string _applyer;
        private DateTime _applydate;
        private string _driveto;
        private string _drivetodesc;
        private string _drivetoother;
        private string _worktaskid;
        private string _worktaskdesc;
        private string _worktaskother;
        private DateTime _plantotime;
        private DateTime _planbacktime;
        private string _approvedby;
        private string _approvednote;
        private string _recdivid;
        private string _recacct;
        private DateTime _recdate;
        private bool _cfm;
        private string _cfmacct;
        private DateTime _cfmdate;
        private bool _void;
        private string _voidacct;
        private DateTime _voiddate;
        private string _useracct;
        private DateTime _lastupdatedate;

        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public int RecID
        {
            set { _recid = value; }
            get { return _recid; }
        }

        /// <sumary> 
        /// (DocID Type:VarChar Len:20) 
        /// </sumary> 
        public string DocID
        {
            set { _docid = value; }
            get { return _docid; }
        }

        /// <sumary> 
        /// (BusID Type:VarChar Len:20) 
        /// </sumary> 
        public string BusID
        {
            set { _busid = value; }
            get { return _busid; }
        }

        /// <sumary> 
        /// (Applyer Type:VarChar Len:20) 
        /// </sumary> 
        public string Applyer
        {
            set { _applyer = value; }
            get { return _applyer; }
        }

        /// <sumary> 
        /// (ApplyDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime ApplyDate
        {
            set { _applydate = value; }
            get { return _applydate; }
        }

        /// <sumary> 
        /// (DriveTo Type:VarChar Len:20) 
        /// </sumary> 
        public string DriveTo
        {
            set { _driveto = value; }
            get { return _driveto; }
        }

        /// <sumary> 
        /// (DriveTo Type:NVarChar Len:200) 
        /// </sumary> 
        public string DriveToDesc
        {
            set { _drivetodesc = value; }
            get { return _drivetodesc; }
        }

        /// <sumary> 
        /// (DriveToOther Type:NVarChar Len:200) 
        /// </sumary> 
        public string DriveToOther
        {
            set { _drivetoother = value; }
            get { return _drivetoother; }
        }

        /// <sumary> 
        /// (WorkTaskID Type:VarChar Len:20) 
        /// </sumary> 
        public string WorkTaskID
        {
            set { _worktaskid = value; }
            get { return _worktaskid; }
        }

        /// <sumary> 
        /// (WorkTaskDesc Type:NVarChar Len:50) 
        /// </sumary> 
        public string WorkTaskDesc
        {
            set { _worktaskdesc = value; }
            get { return _worktaskdesc; }
        }

        /// <sumary> 
        /// (WorkTaskOther Type:NVarChar Len:200) 
        /// </sumary> 
        public string WorkTaskOther
        {
            set { _worktaskother = value; }
            get { return _worktaskother; }
        }

        /// <sumary> 
        /// (PlanToTime Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime PlanToTime
        {
            set { _plantotime = value; }
            get { return _plantotime; }
        }

        /// <sumary> 
        /// (PlanBackTime Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime PlanBackTime
        {
            set { _planbacktime = value; }
            get { return _planbacktime; }
        }

        /// <sumary> 
        /// (ApprovedBy Type:VarChar Len:20) 
        /// </sumary> 
        public string ApprovedBy
        {
            set { _approvedby = value; }
            get { return _approvedby; }
        }

        /// <sumary> 
        /// (ApprovedNote Type:NVarChar Len:50) 
        /// </sumary> 
        public string ApprovedNote
        {
            set { _approvednote = value; }
            get { return _approvednote; }
        }

        /// <sumary> 
        /// (RecDivID Type:VarChar Len:20) 
        /// </sumary> 
        public string RecDivID
        {
            set { _recdivid = value; }
            get { return _recdivid; }
        }

        /// <sumary> 
        /// (RecAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string RecAcct
        {
            set { _recacct = value; }
            get { return _recacct; }
        }

        /// <sumary> 
        /// (RecDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime RecDate
        {
            set { _recdate = value; }
            get { return _recdate; }
        }

        /// <sumary> 
        /// (CFM Type:Bit Len:0) 
        /// </sumary> 
        public bool CFM
        {
            set { _cfm = value; }
            get { return _cfm; }
        }

        /// <sumary> 
        /// (CFMAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string CFMAcct
        {
            set { _cfmacct = value; }
            get { return _cfmacct; }
        }

        /// <sumary> 
        /// (CFMDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime CFMDate
        {
            set { _cfmdate = value; }
            get { return _cfmdate; }
        }

        /// <sumary> 
        /// (Void Type:Bit Len:0) 
        /// </sumary> 
        public bool Void
        {
            set { _void = value; }
            get { return _void; }
        }

        /// <sumary> 
        /// (VoidAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string VoidAcct
        {
            set { _voidacct = value; }
            get { return _voidacct; }
        }

        /// <sumary> 
        /// (VoidDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime VoidDate
        {
            set { _voiddate = value; }
            get { return _voiddate; }
        }

        /// <sumary> 
        /// (UserAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string UserAcct
        {
            set { _useracct = value; }
            get { return _useracct; }
        }

        /// <sumary> 
        /// (LastUpdateDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime LastUpdateDate
        {
            set { _lastupdatedate = value; }
            get { return _lastupdatedate; }
        }

        #endregion --Property--

        #region --New--
        /// <summary>
        /// Constructed Function
        /// </summary>
        public BusApply()
        {
            Init();
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dr">DataRow</param>
        public BusApply(DataRow dr)
        {
            Init();
            SetModel(dr);
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dt">DataTable</param>
        public BusApply(DataTable dt)
        {
            Init();
            SetModel(dt);
        }
        #endregion --New--

        #region --Private--
        /// <summary>
        /// Init The Private variable
        /// </summary>
        private void Init()
        {
            _recid = 0;
            _docid = string.Empty;
            _busid = string.Empty;
            _applyer = string.Empty;
            _applydate = DateTime.MinValue;
            _driveto = string.Empty;
            _drivetodesc = string.Empty;
            _drivetoother = string.Empty;
            _worktaskid = string.Empty;
            _worktaskdesc = string.Empty;
            _worktaskother = string.Empty;
            _plantotime = DateTime.MinValue;
            _planbacktime = DateTime.MinValue;
            _approvedby = string.Empty;
            _approvednote = string.Empty;
            _recdivid = string.Empty;
            _recacct = string.Empty;
            _recdate = DateTime.MinValue;
            _cfm = false;
            _cfmacct = string.Empty;
            _cfmdate = DateTime.MinValue;
            _void = false;
            _voidacct = string.Empty;
            _voiddate = DateTime.MinValue;
            _useracct = string.Empty;
            _lastupdatedate = DateTime.MinValue;
        }
        /// <summary>
        /// SetModel By DataRow
        /// </summary>
        /// <param name="dr">DataRow</param>
        /// <returns>BusApply</returns>
        private BusApply SetModel(DataRow dr)
        {
            _recid = StrHelper.GetIntValue(dr[FIELD_RecID]);
            _docid = StrHelper.GetStringValue(dr[FIELD_DocID]);
            _busid = StrHelper.GetStringValue(dr[FIELD_BusID]);
            _applyer = StrHelper.GetStringValue(dr[FIELD_Applyer]);
            _applydate = StrHelper.GetDateTimeValue(dr[FIELD_ApplyDate]);
            _driveto = StrHelper.GetStringValue(dr[FIELD_DriveTo]);
            _drivetodesc = StrHelper.GetStringValue(dr[FIELD_DriveToDesc]);
            _drivetoother = StrHelper.GetStringValue(dr[FIELD_DriveToOther]);
            _worktaskid = StrHelper.GetStringValue(dr[FIELD_WorkTaskID]);
            _worktaskdesc = StrHelper.GetStringValue(dr[FIELD_WorkTaskDesc]);
            _worktaskother = StrHelper.GetStringValue(dr[FIELD_WorkTaskOther]);
            _plantotime = StrHelper.GetDateTimeValue(dr[FIELD_PlanToTime]);
            _planbacktime = StrHelper.GetDateTimeValue(dr[FIELD_PlanBackTime]);
            _approvedby = StrHelper.GetStringValue(dr[FIELD_ApprovedBy]);
            _approvednote = StrHelper.GetStringValue(dr[FIELD_ApprovedNote]);
            _recdivid = StrHelper.GetStringValue(dr[FIELD_RecDivID]);
            _recacct = StrHelper.GetStringValue(dr[FIELD_RecAcct]);
            _recdate = StrHelper.GetDateTimeValue(dr[FIELD_RecDate]);
            //_cfm = StrHelper.GetBoolValue(dr[FIELD_CFM]);
            //_cfmacct = StrHelper.GetStringValue(dr[FIELD_CFMAcct]);
            //_cfmdate = StrHelper.GetDateTimeValue(dr[FIELD_CFMDate]);
            //_void = StrHelper.GetBoolValue(dr[FIELD_Void]);
            //_voidacct = StrHelper.GetStringValue(dr[FIELD_VoidAcct]);
            //_voiddate = StrHelper.GetDateTimeValue(dr[FIELD_VoidDate]);
            _useracct = StrHelper.GetStringValue(dr[FIELD_UserAcct]);
            _lastupdatedate = StrHelper.GetDateTimeValue(dr[FIELD_LastUpdateDate]);
            return this;
        }
        /// <summary>
        /// SetModel By DataTable
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <returns>BusApply</returns>
        private BusApply SetModel(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                SetModel(dr);
                break;
            }
            return this;
        }
        #endregion --Private--

    }
}

